package cn.fl.ref.fnccappayeeinfobig.transform;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.BeanUtils;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.ref.fnccappayeeinfo.vo.FncCapPayeeInfoVO;
import cn.fl.ref.fnccappayeeinfobig.vo.FncCapPayeeInfoBigVO;
import fl.ref.fnccappayeeinfo.dto.FncCapPayeeInfoDTO;
import fl.ref.fnccappayeeinfobig.dto.FncCapPayeeInfoBigDTO;

/**
 * 服务层与展现层转换类 所有的PO只能在持久成和服务层使用 所有的DTO只能在展现层和服务层使用 在服务层中向下是DTO转PO,向上是PO转DTO
 */
public class FncCapPayeeInfoBigVOTransform {

	/**
	 * VO 转 DTO
	 * 
	 * @param po
	 * @return
	 */
	public static FncCapPayeeInfoBigDTO toDTO(FncCapPayeeInfoBigVO vo) {
		FncCapPayeeInfoBigDTO dto = null;
		if (vo != null) {
			dto = new FncCapPayeeInfoBigDTO();
			BeanUtils.copyProperties(vo, dto);

			dto.setFncScmChrgParmBigList(FncScmChrgParmBigVOTransform.toDTOList(vo.getFncScmChrgParmBigList()));
			
		}
		return dto;
	}

	/**
	 * DTO 转 PO
	 * 
	 * @param dto
	 * @return
	 */
	public static FncCapPayeeInfoBigVO toVO(FncCapPayeeInfoBigDTO dto) {
		FncCapPayeeInfoBigVO vo = null;
		if (dto != null) {
			vo = new FncCapPayeeInfoBigVO();
			BeanUtils.copyProperties(dto, vo);
			vo.setFncScmChrgParmBigList(FncScmChrgParmBigVOTransform.toVOList(dto.getFncScmChrgParmBigList()));
		}
		return vo;
	}

	/**
	 * PO集合 转 DTO集合
	 * 
	 * @param list
	 * @return
	 */
	public static List<FncCapPayeeInfoBigDTO> toDTOList(List<FncCapPayeeInfoBigVO> list) {
		List<FncCapPayeeInfoBigDTO> voList = new ArrayList<FncCapPayeeInfoBigDTO>();
		if (CollectionUtils.isNotEmpty(list)) {
			for (FncCapPayeeInfoBigVO vo : list) {
				voList.add(toDTO(vo));
			}
		}
		return voList;
	}

	/**
	 * DTO集合 转 PO集合
	 * 
	 * @param list
	 * @return
	 */
	public static List<FncCapPayeeInfoBigVO> toVOList(List<FncCapPayeeInfoBigDTO> list) {
		List<FncCapPayeeInfoBigVO> voList = new ArrayList<FncCapPayeeInfoBigVO>();
		if (CollectionUtils.isNotEmpty(list)) {
			for (FncCapPayeeInfoBigDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}

}
